home *** CD-ROM | disk | FTP | other *** search
- /* FindFiles.ged by Troels Walsted Hansen
- ** With searchcode by Eivind Nordseth
- ** $VER: FindFiles.ged v1.00 (09.06.95)
- **
- ** An ARexx script that finds files matching a search pattern on
- ** a chosen bbs and inserts the file information into the GoldED
- ** you are currently using.
- **
- ** History:
- ** ¯¯¯¯¯¯¯¯
- ** FindFiles.ged v1.05 (11.06.95)
- ** · now uses only ONE function from THOR...
- */
-
- options results
-
- /* needs GoldED, THOR and bbsread.library functions */
-
- if(substr(address(),1,6) ~= "GOLDED") then
- do
- say "This script should only be started from inside GoldED."
- exit 20
- end
- else gedport = address()
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- if ~show('p', 'BBSREAD') then
- do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- /* get bbsname */
-
- address (bbsread)
- GETBBSLIST stem BBSLIST
- if(rc ~= 0) then
- do
- address(gedport)
- REQUEST PROBLEM '"'BBSREAD.LASTERROR'"'
- exit 5
- end
-
- address(thorport)
- THORTOFRONT
-
- REQUESTLIST instem BBSLIST title '"Select BBS:"' SIZEGADGET
- if(rc ~= 0) then exit
- else bbs = result
-
- /* get searchpattern */
-
- address(gedport)
- REQUEST BODY '"Please enter search pattern:"' TITLE '"Find file..."' VAR pattern STRING
- if(rc ~= 0 | pattern = "") then exit
-
- address (bbsread)
- SEARCHBRFILE bbsname '"' || bbs || '"' stem SRESULT search '"' || pattern || '"' keyword
-
- if(result > 0) then
- do
- do f=1 to SRESULT.FILEAREA.COUNT
- address(gedport)
- CR
- TEXT T '"' || '(' || SRESULT.FILEAREA.f || ')' || '"'
- CR
-
- do i=1 to SRESULT.FILE.f.COUNT
- call showfiledata('"' || bbs || '"', '"'|| SRESULT.FILEAREA.f || '"', SRESULT.FILE.f.i, gedport)
- end
- end
- end
- else
- do
- address(gedport)
- REQUEST BODY '"No files found."' BUTTON '"_Ok"' TITLE '"Find file..."'
- end
-
- exit
-
- /* Procedure to show the data about a file */
-
- showfiledata: procedure
- parse arg bbs,farea,filenr,gedport
-
- FDF_DELETED = '00000001'x
-
- drop FILE. /* Important */
-
- address (bbsread)
- READBRFILE bbs farea filenr tagsstem FILE datastem DATA
-
- nextfile = result
-
- if (bitand(DATA.FLAGS,FDF_DELETED) ~= FDF_DELETED) then
- do
- if(symbol("FILE.DATE") = "VAR") then fdate = FILE.DATE
- else date = DATA.FILEDATE
-
- AMIGA2DATE fdate CD
- fdatestr = right(CD.YEAR, 2) || right('0'||CD.MONTH, 2) || right('0'||CD.MDAY, 2)
-
- if(symbol("FILE.SIZE") = "VAR") then fsize = FILE.SIZE
- else size = "Unkn"
-
- if(symbol("FILE.DOWNLOADS") = "VAR") then fdnls = FILE.DOWNLOADS
- else fdnls = "Unkn"
-
- if(symbol("FILE.DESCRIPTION.COUNT") = "VAR") then descr = FILE.DESCRIPTION.1
- else descr = "NONE"
-
- address(gedport)
- TEXT T '"' || left(FILE.NAME,16) || " " || fdatestr || " " || right(fsize,7) || right(fdnls,4) || " " || descr || '"'
- CR
-
- if(descr ~= "NONE") then
- do
- if(FILE.DESCRIPTION.COUNT > 1) then
- do
- do n=2 to FILE.DESCRIPTION.COUNT
- address(gedport)
- TEXT T '"' || left("",33) || FILE.DESCRIPTION.n || '"'
- CR
- end
- end
- end
- end
- else
- do
- address(gedport)
- TEXT T '"' || 'File is deleted.' || '"'
- CR
- end
-
- return nextfile
-